package com.jrx.anytxn.reporting.controller;

import com.jrx.anytxn.i18n.response.TxnRespResult;
import com.jrx.anytxn.reporting.dto.MrPaymentLogRes;
import com.jrx.anytxn.reporting.service.IPaymentLogDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jrx.auth.filter.service.InfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xqy
 * @version 1.0
 * @date 2020/4/14
 */
@Api(tags = "监管报送的还款流水接口")
@RestController
@RequestMapping(value = "/mr/payment")
public class MrPaymentLogController {

    @Autowired
    private InfoService infoService;
    @Autowired
    private IPaymentLogDataService paymentLogDataService;

    @ApiOperation(value = "监管报送的还款流水接口")
    @GetMapping(value = "/list")
    public TxnRespResult<ArrayList<MrPaymentLogRes>> getMrCustomersByCusIdOrMobileOrIdNumber(@RequestParam String loanId,  @RequestParam String customerId) {
        TxnRespResult<ArrayList<MrPaymentLogRes>> result = new TxnRespResult();
        String tenantId=String.valueOf(infoService.getUser().getProjectId());
        List<MrPaymentLogRes> mrCustomers = paymentLogDataService.getMrPaymentLogByTenantIdAndLoanIdAndCusId( tenantId,loanId,customerId);
        result.getSuccess((ArrayList)mrCustomers);
        return result;
    }
}